- attribute = local_assigns.fetch(:attribute, nil)
- group = local_assigns.fetch(:group, nil)
- form = local_assigns.fetch(:form, nil)
- setting_locked = local_assigns.fetch(:setting_locked, false)
- help_text = local_assigns.fetch(:help_text, s_('CascadingSettings|Subgroups cannot change this setting.'))
- label = local_assigns.fetch(:label, s_('CascadingSettings|Enforce for all subgroups'))

- return unless attribute && group && form
- return if setting_locked

- lock_attribute = "lock_#{attribute}"

= form.gitlab_ui_checkbox_component lock_attribute,
  label,
  help_text: help_text,
  checkbox_options: { checked: group.namespace_settings.public_send(lock_attribute), data: { testid: 'enforce-for-all-subgroups-checkbox' } }
